package com.learning.algorithm.sort;

import java.util.Arrays;

/**
 * @Author: lishi
 * @Description: 排序检测
 * @Date: 2021/11/19 9:32
 */
public class CheckSort {

    public static boolean checkSortResult(int[] originArray,int[] sortArrays) {
        int[] cloneArray = new int[originArray.length];
        System.arraycopy(originArray, 0, cloneArray, 0, originArray.length);

        Arrays.sort(cloneArray);

        for (int i = 0; i < originArray.length; i++) {
            if (cloneArray[i] != sortArrays[i]) {
                return false;
            }
        }
        return true;
    }
}
